﻿using SlimDX;
using SlimDX.XInput;

namespace GamepadDriver
{
	public static class GamepadExtensions
	{
		public static Vector2 GetLeftThumb(this Gamepad @this)
		{
			return new Vector2((float)@this.LeftThumbX / short.MaxValue, (float)@this.LeftThumbY / short.MaxValue);
		}

		public static Vector2 GetRightThumb(this Gamepad @this)
		{
			return new Vector2((float)@this.RightThumbX / short.MaxValue, (float)@this.RightThumbY / short.MaxValue);
		}

		public static bool IsButtonPressed(this Gamepad @this, GamepadButtonFlags button)
		{
			return (@this.Buttons & button) == button;
		}
	}
}